home *** CD-ROM | disk | FTP | other *** search
/ Beginning Mac Programming / Beginning Mac Programming.bin / pc / Open Me for REALbasic 3 / REALbasic 3.2 / Example Projects / Techniques / Char Set & String Stuff / CharSet source code / Includes / REALplugin.h < prev    next >
Encoding:
Text File  |  2000-06-16  |  10.5 KB  |  450 lines

  1. // REALplugin.h
  2. //
  3. //    This file is part of the REALbasic plugin API.  It's included automatically
  4. //    by "rb_plugin.h", so normally you'll just include the latter.
  5. //
  6. // © 1997-2000 REAL Software Inc. -- All Rights Reserved
  7.  
  8. #ifndef REALPLUGIN_H
  9. #define REALPLUGIN_H
  10.  
  11. #if TARGET_CPU_68K
  12.     // Compile with Metrowerks-ish/Think C calling conventions:
  13.     // Turn "MPW C" option off, and return pointers in D0 rather than A0.
  14.     #pragma d0_pointers on
  15.     #pragma mpwc off
  16. #endif
  17.  
  18. // define some shorter macros for the four kinds of targets we support
  19. #if WIN32
  20.     #define TARGET_WIN32 1
  21. #endif
  22. #if TARGET_CPU_68K
  23.     #define TARGET_68K 1
  24. #endif
  25. #if TARGET_CPU_PPC
  26.     #if TARGET_API_MAC_CARBON
  27.         #define TARGET_CARBON 1
  28.     #else
  29.         #define TARGET_PPC 1
  30.     #endif
  31. #endif
  32.  
  33. // define some constants for use with REALGetControlPosition etc.
  34. #define kREALLeft 0
  35. #define kREALTop 1
  36. #define kREALWidth 2
  37. #define kREALHeight 3
  38.  
  39. struct REALstringStruct
  40. {
  41. // This structure is for examination purposes only!
  42. // Do not construct them yourself - use REALBuildString!
  43. private:
  44.     long mPrivateUsageCount;
  45.     unsigned char *mPrivateStringData;
  46.     long mPrivateAllocLength;
  47.     long mPrivateLength;
  48. public:
  49.     long Length(void);
  50.     const char *CString();
  51.     const unsigned char *PString();
  52. };
  53.  
  54. typedef REALstringStruct *REALstring;
  55.  
  56. typedef void (*REALproc)(void);
  57.  
  58. struct REALdbDatabaseStruct;
  59. typedef REALdbDatabaseStruct *REALdbDatabase;
  60.  
  61. struct REALdbCursorStruct;
  62. typedef REALdbCursorStruct *REALdbCursor;
  63.  
  64. struct REALcontrolInstanceStruct;
  65. typedef REALcontrolInstanceStruct *REALcontrolInstance;
  66.  
  67. struct REALgraphicsStruct;
  68. typedef REALgraphicsStruct *REALgraphics;
  69.  
  70. struct REALobjectStruct;
  71. typedef REALobjectStruct *REALobject;
  72.  
  73. struct REALfolderItemStruct;
  74. typedef REALfolderItemStruct *REALfolderItem;
  75.  
  76. struct REALpictureStruct;
  77. typedef REALpictureStruct *REALpicture;
  78.  
  79. struct REALsoundStruct;
  80. typedef REALsoundStruct *REALsound;
  81.  
  82. struct REALappleEventStruct;
  83. typedef REALappleEventStruct *REALappleEvent;
  84.  
  85. struct REALwindowStruct;
  86. typedef REALwindowStruct *REALwindow;
  87.  
  88. struct REALpopupMenuStruct;
  89. typedef REALpopupMenuStruct *REALpopupMenu;
  90.  
  91. struct REALmovieStruct;
  92. typedef REALmovieStruct *REALmovie;
  93.  
  94. struct REALmoviePlayerStruct;
  95. typedef REALmoviePlayerStruct *REALmoviePlayer;
  96.  
  97. struct REALsocketStruct;
  98. typedef REALsocketStruct *REALsocket;
  99.  
  100. #define REALnoImplementation ((REALproc) nil)
  101.  
  102. struct REALmethodDefinition
  103. {
  104.     REALproc function;
  105.     REALproc setterFunction;
  106.     const char *declaration;
  107. };
  108.  
  109. #define REALpropInvalidate 1
  110. #define REALpropRuntimeOnly 2
  111.  
  112. #define REALstandardGetter ((REALproc) -1)
  113. #define REALstandardSetter ((REALproc) -1)
  114.  
  115. struct REALproperty
  116. {
  117.     const char *group;
  118.     const char *name;
  119.     const char *type;
  120.     int flags;
  121.     REALproc getter;
  122.     REALproc setter;
  123.     int param;
  124.     REALproc editor;
  125.     int enumCount;
  126.     const char **enumEntries;
  127. };
  128.  
  129. struct REALevent
  130. {
  131.     const char *declaration;
  132.     int forSystemUse;
  133. };
  134.  
  135. struct REALeventInstance
  136. {
  137.     const char *name;
  138.     REALproc implementation;
  139. };
  140.  
  141. struct REALbindingDescription
  142. {
  143.     const char *szInterface;
  144.     const char *szDescription;
  145.     const char *szPart;
  146. };
  147.  
  148. struct REALcontrolBehaviour
  149. {
  150.     void (*constructorFunction)(REALcontrolInstance);
  151.     void (*destructorFunction)(REALcontrolInstance);
  152. #ifdef WIN32
  153.     void (*redrawFunction)(REALcontrolInstance, REALgraphics context);
  154. #else
  155.     void (*redrawFunction)(REALcontrolInstance);
  156. #endif
  157.     Boolean (*clickFunction)(REALcontrolInstance, int, int, int);
  158.     void (*mouseDragFunction)(REALcontrolInstance, int, int);
  159.     void (*mouseUpFunction)(REALcontrolInstance, int, int);
  160.     void (*gainedFocusFunction)(REALcontrolInstance);
  161.     void (*lostFocusFunction)(REALcontrolInstance);
  162.     REALproc keyDownFunction;
  163.     void (*openFunction)(REALcontrolInstance);
  164.     void (*closeFunction)(REALcontrolInstance);
  165.     void (*backgroundIdleFunction)(REALcontrolInstance);
  166.     void (*drawOffscreenFunction)(REALcontrolInstance, REALgraphics context);
  167.     void (*setSpecialBackground)(REALcontrolInstance);
  168.     void (*constantChanging)(REALcontrolInstance, REALstring);
  169.     void (*droppedNewInstance)(REALcontrolInstance);
  170.  
  171.     REALproc unusedFunction1;
  172.     REALproc unusedFunction2;
  173.     REALproc unusedFunction3;
  174.     REALproc unusedFunction4;
  175.     REALproc unusedFunction5;
  176.     REALproc unusedFunction6;
  177.     REALproc unusedFunction7;
  178.     REALproc unusedFunction8;
  179.     REALproc unusedFunction9;
  180. };
  181.  
  182. #define kCurrentREALControlVersion 5
  183.  
  184. #define REALcontrolAcceptFocus 1
  185. #define REALcontrolFocusRing 2
  186. #define REALinvisibleControl 4
  187. #define REALopaqueControl 8
  188. #define REALenabledControl 16
  189.  
  190. struct REALcontrol
  191. {
  192.     int version;
  193.     const char *name;
  194.     int dataSize;
  195.     int flags;
  196.     int toolbarPICT, toolbarDownPICT;
  197.     int defaultWidth, defaultHeight;
  198.     REALproperty *properties;
  199.     int propertyCount;
  200.     REALmethodDefinition *methods;
  201.     int methodCount;
  202.     REALevent *events;
  203.     int eventCount;
  204.     REALcontrolBehaviour *behaviour;
  205.     int forSystemUse;
  206.     REALeventInstance *eventInstances;
  207.     int eventInstanceCount;
  208.     const char *interfaces;
  209.     REALbindingDescription *bindDescriptions;
  210.     int bindDescriptionCount;
  211. };
  212.  
  213. struct REALclassDefinition
  214. {
  215.     int version;
  216.     const char *name;
  217.     const char *superName;
  218.     int dataSize;
  219.     int forSystemUse;
  220.     REALproc constructor;
  221.     REALproc destructor;
  222.     REALproperty *properties;
  223.     int propertyCount;
  224.     REALmethodDefinition *methods;
  225.     int methodCount;
  226.     REALevent *events;
  227.     int eventCount;
  228.     REALeventInstance *eventInstances;
  229.     int eventInstanceCount;
  230.     const char *interfaces;
  231.     REALbindingDescription *bindDescriptions;
  232.     int bindDescriptionCount;
  233. };
  234.  
  235. #if !TARGET_WIN32
  236. typedef void (*REALEventCallback)(EventRecord *event, long param);
  237. #endif
  238.  
  239. #define kCurrentREALDatabaseVersion 1
  240.  
  241. typedef void (*REALDataSourceInterfaceProc)(void);
  242. typedef REALdbDatabase (*REALDataSourceProc)(Ptr data, int dataLen);
  243.  
  244. struct dbDatabase;
  245. struct dbTable;
  246. struct dbCursor;
  247.  
  248. struct dbDate
  249. {
  250.     short year;
  251.     short month;
  252.     short day;
  253. };
  254.  
  255. struct dbTime
  256. {
  257.     short hour;
  258.     short minute;
  259.     short second;
  260. };
  261.  
  262. struct dbTimeStamp
  263. {
  264.     short year;
  265.     short month;
  266.     short day;
  267.     short hour;
  268.     short minute;
  269.     short second;
  270. };
  271.  
  272. enum dbFieldType
  273. {
  274.     dbTypeNull,
  275.     dbTypeByte,
  276.     dbTypeShort,
  277.     dbTypeLong,
  278.     dbTypeChar,
  279.     dbTypeText,
  280.     dbTypeFloat,
  281.     dbTypeDouble,
  282.     dbTypeDate,
  283.     dbTypeTime,
  284.     dbTypeTimeStamp,
  285.     dbTypeCurrency,
  286.     dbTypeBoolean,
  287.     dbTypeDecimal,
  288.     dbTypeBinary,
  289.     dbTypeLongText,
  290.     dbTypeLongBinary,
  291.     dbTypeMacPICT,
  292.     dbTypeUnknown = 255
  293. };
  294.  
  295. struct REALnewColumn
  296. {
  297.     REALnewColumn *nextColumn;
  298.     REALstring columnName;
  299.     long columnType;
  300.     long bAllowNULL;
  301. };
  302.  
  303. struct REALcolumnValue
  304. {
  305.     REALcolumnValue *nextColumn;
  306.     REALstring columnName;
  307.     REALstring columnValue;
  308. };
  309.  
  310. enum REALcolumnOperation
  311. {
  312.     rcOpEquals,
  313.     rcOpLessThan,
  314.     rcOpGreaterThan,
  315.     rcOpLessThanEqual,
  316.     rcOpGreaterThanEqual,
  317.     rcOpNotEqual,
  318.     rcOpLike,
  319.     rcOpNotLike,
  320.     rcOpIsNull,
  321.     rcOpIsNotNull,
  322.  
  323.     rcOpAnd = 64,
  324.     rcOpOr
  325. };
  326.  
  327. struct REALcolumnConstraints
  328. {
  329.     REALcolumnConstraints *left, *right;
  330.     REALcolumnOperation columnOperation;
  331.     REALstring column;
  332.     REALstring value;
  333. };
  334.  
  335. struct REALgetColumn
  336. {
  337.     REALgetColumn *next;
  338.     REALstring column;
  339. };
  340.  
  341. enum {
  342.     dbEnginePrimaryKeySupported = 1,
  343.     dbEngineAlterTableAddParens = 2,
  344.     dbEngineDontUseBrackets = 4
  345. };
  346.  
  347. struct REALfieldUpdate
  348. {
  349.     REALfieldUpdate *next;
  350.     Ptr tableField;
  351.     int tableFieldLen;
  352.     Ptr recordKey;
  353.     int recordKeyLen;
  354.     REALstring value;
  355. };
  356.  
  357. struct REALdbEngineDefinition
  358. {
  359.     int version;
  360.     unsigned char forSystemUse;
  361.     unsigned char flags1;
  362.     unsigned char flags2;
  363.     unsigned char flags3;
  364.  
  365.     void (*closeDatabase)(dbDatabase *); // void (*closeDatabase)(dbDatabase *);
  366.  
  367.     REALdbCursor (*getTableSchemaCursor)(dbDatabase *); // dbCursor *(*tableCursor)(dbDatabase *)) /* optional */
  368.     REALdbCursor (*getFieldSchemaCursor)(dbDatabase *, REALstring); // dbCursor *(*fieldCursor)(dbDatabase *, REALstring)) /* optional */
  369.  
  370.     REALdbCursor (*directSQLSelect)(dbDatabase *, REALstring); // DatabaseCursorObject (*directSQLSelect)(dbDatabase *, REALstring selectString);
  371.     void (*directSQLExecute)(dbDatabase *, REALstring); // void (*directSQLExecute)(dbDatabase *, REALstring executeString);
  372.  
  373.     void (*createTable)(dbDatabase *, REALstring, REALnewColumn *, unsigned char *, int); // void (*createTable)(dbDatabase *, REALstring name, REALnewColumn *columns, unsigned char *primaryKey, int primaryKeyCount);
  374.     void (*addTableRecord)(dbDatabase *, REALstring, REALcolumnValue *); // void (*addTableRecord)(dbDatabase *, REALstring tableName, REALcolumnValue *values);
  375.     REALdbCursor (*getTableCursor)(dbDatabase *, REALstring, REALgetColumn *, REALcolumnConstraints *); // DatabaseCursorObject *(*getTableCursor)(dbDatabase *, REALstring tableName, REALgetColumn *columns, REALcolumnConstraints *constraints);
  376.  
  377.     void (*updateFields)(dbDatabase *, REALfieldUpdate *fields);
  378.     void (*addTableColumn)(dbDatabase *, REALstring, REALnewColumn *);
  379.     REALdbCursor (*getDatabaseIndexes)(dbDatabase *, REALstring table);
  380.  
  381.     long (*getLastErrorCode)(dbDatabase *);
  382.     REALstring (*getLastErrorString)(dbDatabase *);
  383.  
  384.     void (*commit)(dbDatabase *);
  385.     void (*rollback)(dbDatabase *);
  386.  
  387.     REALstring (*getProperty)(dbDatabase *, REALstring propertyName);
  388.  
  389.     REALproc unused1;
  390.     REALproc unused2;
  391.     REALproc unused3;
  392.     REALproc unused4;
  393.     REALproc unused5;
  394.     REALproc unused6;
  395.     REALproc unused7;
  396.     REALproc unused8;
  397.     REALproc unused9;
  398.     REALproc unused10;
  399. };
  400.  
  401. struct REALdbTableDefinition
  402. {
  403.     int version;
  404.     int forSystemUse;
  405.  
  406.     REALproc closeTable; // void (*closeTable)(dbTable *);
  407.     REALproc tableCursor; // dbCursor *(*tableCursor)(dbTable *);
  408. };
  409.  
  410. struct REALcursorUpdate
  411. {
  412.     REALcursorUpdate *next;
  413.     int fieldIndex;
  414.     REALstring columnValue;
  415. };
  416.  
  417. struct REALdbCursorDefinition
  418. {
  419.     int version;
  420.     int forSystemUse;
  421.  
  422.     void (*closeCursor)(dbCursor *);
  423.     int (*cursorColumnCount)(dbCursor *); // int (*cursorColumnCount)(dbCursor *);
  424.     REALstring (*cursorColumnName)(dbCursor *, int column); // REALstring (*cursorColumnName)(dbCursor *, int column); /* optional */
  425.     int (*cursorRowCount)(dbCursor *); // int (*cursorRowCount)(dbCursor *); /* optional */
  426.     void (*cursorColumnValue)(dbCursor *, int, Ptr *, dbFieldType *, int *); // void (*cursorColumnValue)(dbCursor *, int column, Ptr *value, dbFieldType *type, int *length);
  427.     void (*cursorReleaseValue)(dbCursor *); // void (*cursorReleaseValue)(dbCursor *); /* optional */
  428.     Boolean (*cursorNextRow)(dbCursor *); // Boolean (*cursorNextRow)(dbCursor *);
  429.     void (*cursorDelete)(dbCursor *); // void (*cursorDelete)(dbCursor *);
  430.     void (*cursorDeleteAll)(dbCursor *); // void (*cursorDeleteAll)(dbCursor *);
  431.     Boolean (*cursorFieldKey)(dbCursor *, int, Ptr *, int *, Ptr *, int *);
  432.     void (*cursorUpdate)(dbCursor *, REALcursorUpdate *fields);
  433.     void (*cursorEdit)(dbCursor *);            // called by dbCursor.Edit in RB
  434.     void *dummy4;
  435.     void *dummy5;
  436.     void *dummy6;
  437.     void *dummy7;
  438.     void *dummy8;
  439.     void *dummy9;
  440.     void *dummy10;
  441. };
  442.  
  443. #define FieldOffset(type, field) (long)(&((type *) 0)->field)
  444.  
  445. extern "C" {
  446. void PluginEntry(void);
  447. }
  448.  
  449. #endif
  450.